package com.yima.baseproj.module.sys.menu;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yima.baseproj.module.sys.menu.model.SysMenuAddParamModel;
import com.yima.baseproj.module.config.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

@Data
@TableName(value = "sys_menu",autoResultMap = true)
public class SysMenuEntity extends BaseEntity {

  @ApiModelProperty(value = "角色名称")
  @TableField(value = "name")
  private String name;

  @ApiModelProperty(value = "图标")
  @TableField(value = "icon")
  private String icon;

  @ApiModelProperty(value = "父级id")
  @TableField(value = "pid")
  private String pid;

  @ApiModelProperty(value = "路由")
  @TableField(value = "router_url")
  private String routerUrl;

  @ApiModelProperty(value = "路由参数")
  @TableField(value = "router_param")
  private String routerParam;

  @ApiModelProperty(value = "前端组件路径")
  @TableField(value = "component")
  private String component;

  @ApiModelProperty(value = "类型：菜单，子菜单，功能")
  @TableField(value = "type")
  private String type;

  @ApiModelProperty(value = "权限标识")
  @TableField(value = "permission")
  private String permission;

  @ApiModelProperty(value = "备注")
  @TableField(value = "remark")
  private String remark;

  @ApiModelProperty(value = "状态：正常，禁用")
  @TableField(value = "is_show")
  private Boolean isShow;

  @ApiModelProperty(value = "排序")
  @TableField(value = "sort")
  private Integer sort;

  @ApiModelProperty(value = "等级字符串")
  @TableField(value = "level_str")
  private String levelStr;

  public void setSysMenuEntity(SysMenuAddParamModel menu) {
    this.name =menu.getName();
    this.icon = menu.getIcon();
    this.routerUrl = menu.getRouterUrl();
    this.routerParam = menu.getRouterParam();
    this.component = menu.getComponent();
    this.type = menu.getType();
    this.permission = menu.getPermission();
    this.isShow = menu.getIsShow();
    this.remark = menu.getRemark();
    this.pid = menu.getPid();
    this.sort=menu.getSort();
  }

  public SysMenuEntity() {

  }
}